
#include "SQLOrderingSpecification.h"
#include "../../utils/StringUtils.h"
#include "../../utils/log.h"

SQLOrderingSpecification SQLOrderingSpecification::ASC = SQLOrderingSpecification(1ULL<<0,make_string_ptr("ASC"));
SQLOrderingSpecification SQLOrderingSpecification::DESC = SQLOrderingSpecification(1ULL<<1,make_string_ptr("DESC"));

SQLOrderingSpecification::SQLOrderingSpecification(int x)
{
	this->num = x;
}

SQLOrderingSpecification::SQLOrderingSpecification(uint64_t mask_, string_ptr name_)
{
	this->name = name_;
	this->mask = mask_;
	// this->nameLCase = name.toLowerCase();
	// std::transform(name->begin(), name->end(), std::back_inserter(this->nameLCase), [](unsigned char c){ return std::tolower(c); });
	// LOG_INFO << "name:" << this->name->c_str();
	this->nameLCase = StringUtils::toLower(name_);
}

SQLOrderingSpecification::SQLOrderingSpecification(SQLOrderingSpecification *sqlOrderingSpecification){
this->mask = sqlOrderingSpecification->mask;
this->name = sqlOrderingSpecification->name;
this->nameLCase = sqlOrderingSpecification->nameLCase;
}

SQLOrderingSpecification::~SQLOrderingSpecification()
{
}

string_ptr SQLOrderingSpecification::toString()
{
	return name;
}
